package processingExample;
import processing.core.PApplet;
import java.awt.event.*; //needed for MouseEvent

@SuppressWarnings("serial")
public class processingExample4 extends PApplet
{
	int currentX = 100;//keeps track of shape's x
	int currentY = 50;//keeps track of shape's y
	int destinationX;
	int destinationY;

	public void setup()
	{ 
		size(500, 500);
		background(255, 255, 70);
	}

	public void draw()
	{
		stroke(190, 129, 247);
		fill(255, 0, 51);
		ellipse(currentX, currentY, 30, 70);

		if(currentX<destinationX)
			currentX++;
		else if(currentX>destinationX)
			currentX--;
		
		if(currentY<destinationY)
			currentY++;
		else if(currentY>destinationY)
			currentY--;
	}

	public void mousePressed(MouseEvent e)
	{
		System.out.println("position(x,y): " + e.getX() + "," + e.getY());
		destinationX = e.getX();
		destinationY = e.getY();
	}
}